package com.mm.dictionary.controller;


import com.mm.common.annotation.Log;
import com.mm.common.domain.po.Result;
import com.mm.dictionary.service.WordServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * @BelongsProject: 9.English_dictionary
 * @BelongsPackage: com.example.english_dictionary.controller
 * @Author : 游在海里的鱼
 * @CreateTime : 2024-05-13  21:16
 * @Version : 1.0
 * @ClassName : TODO
 * @Description : TODO
 */
@Slf4j
@Api(tags = "单词相关接口")
@RequestMapping("/word")
@RestController
@RequiredArgsConstructor
public class WordController {

    private final WordServiceImpl wordService;

    @Log(name = "解析文本")
    @ApiOperation("解析文本接口")
    @PostMapping("analysis")
    public Result analysisText(String text){
        return wordService.analysisText(text);
    }

    @Log(name = "获取时间排序的单词表")
    @ApiOperation("时间排序单词表接口")
    @GetMapping("selectAllByTime")
    public Result getWordsByTime(Integer page){
        return wordService.getWordsByTime(page);
    }

    @Log(name = "获取总数排序的单词表")
    @ApiOperation("总数排序单词表接口")
    @GetMapping("selectAllByCount")
    public Result getWordsByCount(Integer page){
        return wordService.getWordsByCount(page);
    }
}
